<template>
    <div class="com_exceed">
        <div class="exceed_title">
            <div class="exceed_title_icon" v-show="false">!</div>
            <div class="exceed_title_cont" v-show="false">超标企业数量:</div>
            <div class="exceed_num" v-html="dataList.length" v-show="false">00</div>
        </div>
        <div class="exceed_list">
            <div class="exceed_item" v-if="dataList.length > 0" v-for="(item, index) in dataList" :key="index" >
                <!-- 序号 -->
                <div
                    class="exceed_item_index"
                    v-html="index < 10 ? '0' + (index + 1) : index + 1"
                ></div>
                <div class="exceed_item_info">
                    <div class="exceed_item_company">
                        <span v-html="item.company_name"></span>
                        <!-- <div class="exceed_item_time">00:00</div> -->
                        <div class="exceed_item_time" v-html="item.ctime"></div>
                    </div>
                    <div class="exceed_item_addr" v-if="false"> 地址: 广州市天河区建工路180号 </div>
                </div>
                <div class="exceed_item_amount">
                    <!-- <span class="exceed_amount">9.9</span> -->
                    <span class="exceed_amount" v-html="item.value"></span>
                    <span class="exceed_unit">mg/m³</span>
                </div>
            </div>
            <div class="exceed_none" v-if="dataList.length == 0">
                暂无超标信息
            </div>
        </div>
    </div>
</template>

<script>
// import _tempData from "../temp/exceed_data" // 临时数据
import { overStandardRealTime } from '@/api/api' // 引入api请求
export default {
    name: "ExceedCom",
    props: ['isReady'],
    data () {
        return {
            dataList: []
        }
    },
    mounted () {
    },
    watch: {
        isReady (nv, ov) { // 监听地图点是否加载成功
            this.overStandardRealTime()
        }
    },
    methods: {
        overStandardRealTime () {
            overStandardRealTime()
                .then(res => {
                    if(res.status==200&&res.data.code==2000){
                        this.dataList = []
                        this.dataList = res.data.list.list.map(v => {
                            return {
                                company_name: v.company_name,
                                ctime: this.$dateFormat("HH:MM", v.ctime * 1000),
                                addr: v.address||'-',
                                value: v.value
                            }
                        })
                    }
                })
                .catch(err => {
                    console.log(err);
                })
        }
    }
}
</script>